#查看隐藏知识
from data_load import get_dataset,get_dataloader
import numpy as np
from matplotlib import pyplot as plt

def softmax_t(x, t):
    x_exp = np.exp(x / t)
    return x_exp / np.sum(x_exp)
# 通过刚刚定义的数据集加载函数，加载数据集
val_dataset_plt = get_dataset(mode='test')
val_dataloader_plt = get_dataloader(val_dataset_plt, batch_size=1, mode='test')

# 这段代码可多次执行看看效果
teacher_model.eval()
with paddle.no_grad():
    data, target = next(iter(val_dataloader_plt))
    output = teacher_model(data)

test_x = data.cpu().numpy()
y_out = output.cpu().numpy()
y_out = y_out[0, ::]
print('Output (NO softmax):', y_out)

plt.subplot(3, 1, 1)
plt.imshow(test_x[0, 0, ::])

plt.subplot(3, 1, 2)
plt.bar(list(range(10)), softmax_t(y_out, 1), width=0.3)

plt.subplot(3, 1, 3)
plt.bar(list(range(10)), softmax_t(y_out, 10), width=0.3)
plt.show()